<?
$rtime 		= microtime();
$rtime 		= explode(" ",$rtime);
$rtime 		= $rtime[1] + $rtime[0];
$start_rb 	= $rtime;

require_once 'core/Debug.php';
require_once 'core/config.php';//System Config...
global $server_list;

if(isset($_GET['del_c']) && (int)$_GET['del_c']==2009)
{
	if(SYS_OS == 'linux')
	{
		system("rm -fr ./_cache");
	}
	else 
	{
		function empty_all_dir($name, $remove = false)
		{
			if(is_dir($name))
			{
				if($dir = opendir($name))
				{
					$dirs = array();
					while($file=readdir($dir))
					{
						if($file!='..' and $file!='.')
						{
							if(is_dir($name.'/'.$file))
							{
								$dirs[]=$file;
							}
							else
							{
								@unlink($name.'/'.$file);
							}
						}
					}
					
					closedir($dir);
					
					foreach($dirs as $dir_)
					{
						empty_all_dir($name.'/'.$dir_, $remove);
					}
					
					if($remove)
					{
						@rmdir($name);
					}
				}		
			}
		}
		
		empty_all_dir('_cache/',true);
	}
}
elseif($server_list)
{
	foreach ($server_list as $server)
	{
		$link = "http://{$server}/delcache.php?del_c=2009";	
				
		if(@fopen($link,"r")){
			echo "run service in $link<br>";					
		}
		else{
			echo "error in $link<br>";
		}
	}
}
	
$mtime 			= microtime();
$mtime 			= explode(" ",$mtime);
$mtime 			= $mtime[1] + $mtime[0];
$end_rb 		= $mtime;			
$page_load_time = round(($end_rb - $start_rb),5)."s";

echo "Done in $page_load_time". "<br>";
?>
